package com.galaxy.workflow.api;

import com.galaxy.common.core.domain.R;
import com.galaxy.workflow.config.FeignConfig;
import com.galaxy.workflow.domain.DeviceBase;
import com.galaxy.workflow.domain.DeviceLocation;
import com.galaxy.workflow.domain.DeviceMaintenance;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 设备服务接口
 */
@FeignClient(
    name = "remoteDeviceService",
    url = "http://localhost:8080/vending"
)
public interface RemoteDeviceService {

    /**
     * 更新设备维护状态
     */
    @RequestMapping(method = RequestMethod.PUT, value = "/maintenance", consumes = "application/json")
    R<Void> updateDeviceStatus(@RequestBody DeviceMaintenance deviceMaintenance);

    /**
     * 更新设备为维修状态
     */
    @RequestMapping(method = RequestMethod.PUT, value = "/base/updateStatusOfflineByDeviceNo/{deviceID}", consumes = "application/json")
    R<Boolean> updateDeviceOnline(@PathVariable("deviceID") Long deviceID);

    /**
     * 获取设备维护信息
     */
    @RequestMapping(method = RequestMethod.GET, value = "/maintenance/{id}", consumes = "application/json")
    R<DeviceMaintenance> getDeviceMaintenance(@PathVariable("id") Long id);

//    @RequestMapping(method = RequestMethod.GET, value = "/maintenance/{id}", consumes = "application/json")
//    R<DeviceMaintenance> getDeviceMaintenance(@PathVariable("id") Long id);

    @RequestMapping(method = RequestMethod.PUT, value = "/location", consumes = "application/json")
    R<Void> updateLocation(@RequestBody DeviceLocation deviceLocation);

    @RequestMapping(method = RequestMethod.GET, value = "/location/byId/{id}", consumes = "application/json")
    R<DeviceLocation> getDeviceLocation(@PathVariable("id") Long id);

}
